# Makefile for GNU C++ compiler.
#   Copyright (C) 1987, 1988 Free Software Foundation, Inc.
#   Hacked by Michael Tiemann (tiemann@mcc.com)

#This file is part of GNU CC.

#GNU CC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 1, or (at your option)
#any later version.

#GNU CC is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with GNU CC; see the file COPYING.  If not, write to
#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.


# Variables you should change for certain systems:

# These are what you would need on HPUX:
# CFLAGS = -Wc,-Ns2000 -Wc,-Ne700 -Wc,-Np300
# If you are using the GNU assembler and linker on HPUX,
# add -I../hp-include to CFLAGS.
# -g is desirable in CFLAGS, but a compiler bug in HPUX version 5
# bites whenever tree.def, rtl.def or machmode.def is included
# (ie., on every source file).
# CCLIBFLAGS = -Wc,-Ns2000 -Wc,-Ne700
# For CCLIBFLAGS you might want to specify the switch that
# forces only 68000 instructions to be used.

# If you are making gcc for the first time, and if you are compiling it with
# a non-gcc compiler, and if your system doesn't have a working alloca() in any
# of the standard libraries (as is true for HP/UX or Genix),
# then get alloca.c from GNU Emacs and un-comment the following line:
# ALLOCA = alloca.o

# If your system has alloca() in /lib/libPW.a, un-comment the following line:
# CLIB= -lPW

# If your system's malloc() routine fails for any reason (as it does on
# certain versions of Genix), try getting the files
# malloc.c and getpagesize.h from GNU Emacs and un-comment the following line:
# MALLOC = malloc.o

# If you are running GCC on an Apollo, you will need this:
# CFLAGS = -g -O -M 3000 -U__STDC__ -DSHORT_ENUM_BUG


# Variables that exist for you to override.

CFLAGS = -g -DSOS -DESKIT
# CFLAGS = -g -O
CC = ../gcc/gcc -B../gcc/
BISON = bison
BISONFLAGS = -v -d
AR = ar
SHELL = /bin/sh
# on sysV, define this as cp.
INSTALL = install -c
MAKE = make

# Compiler to use for compiling gnulib.
# OLDCC should not be the GNU C compiler.
OLDCC = cc

# CFLAGS for use with OLDCC, for compiling gnulib.
CCLIBFLAGS=

# prefix = /home/sioux/mdt

# Directory in which to put the executable for the command `g++'
bindir = $(prefix)/usr/local/bin
# Directory in which to put the subprograms used by the compiler.
libdir = $(prefix)/usr/local/lib
# Directory in which to put the crt0+.o, crt1+.o, and other such files.
startdir = $(prefix)/usr/local/lib
# Directory in which to put man pages.
mandir = $(prefix)/usr/local/man/man1
# Number to put in man-page filename.
manext = 1

# Additional system libraries to link with.
CLIB=

# Change this to a null string if obstacks are installed in the
# system library.
OBSTACK=obstack.o

# Dependency on obstack, alloca, malloc or whatever library facilities
# are not installed in the system libraries.
LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)

# How to link with both our special library facilities
# and the system's installed libraries.
LIBS = $(OBSTACK) $(ALLOCA) $(MALLOC) $(CLIB)

# this is where GNU CC sources are
DIR = ../gcc
# this is the GNU CC build directory
TDIR = ../gcc-test

# End of variables for you to override.

# Always use -Iconfig when compiling.
.c.o:
	$(CC) -c $(CFLAGS) $(CPPFLAGS) -Iconfig $<

# Language-specific object files for C.
C_OBJS = c-parse.tab.o c-decl.o c-typeck.o c-convert.o

# Language-specific object files for C++.
CPLUS_OBJS = cplus-parse.tab.o cplus-decl.o cplus-typeck.o \
 cplus-lex.o cplus-class.o cplus-init.o \
 cplus-method.o cplus-cvt.o cplus-search.o cplus-ptree.o

# Language-independent object files.
OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
 rtl.o expr.o stmt.o expmed.o explow.o optabs.o varasm.o \
 symout.o dbxout.o sdbout.o emit-rtl.o insn-emit.o \
 integrate.o jump.o cse.o loop.o flow.o stupid.o combine.o \
 regclass.o local-alloc.o global-alloc.o reload.o reload1.o caller-save.o \
 insn-peep.o final.o recog.o insn-recog.o insn-extract.o insn-output.o

# Files to be copied away after each stage in building.
STAGE_GCC=gcc
STAGESTUFF = *.o insn-flags.h insn-config.h insn-codes.h \
 insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
 genemit genoutput genrecog genextract genflags gencodes genconfig genpeep \
 cc1plus g++ ld++

# Header files that are made available to programs compiled with gcc.
USER_H = stddef.h stdarg.h assert.h varargs.h va-*.h limits.h

# If you want to recompile everything, just do rm *.o.
# CONFIG_H = config.h tm.h
CONFIG_H =
RTL_H = rtl.h rtl.def machmode.def
TREE_H = tree.h real.h tree.def machmode.def
CPLUS_TREE_H = $(TREE_H) cplus-tree.h c-tree.h

# gnulib is not a target because a proper installation of GNU CC
# will place it where g++ can find it.  Same with cpp
all: g++ cc1plus crt0+.o crt1+.o ld++ # collect

doc: cpp.info g++.info

compilations: ${OBJS} ${CPLUS_OBJS}

g++: gcc.o $(LIBDEPS) version.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o g++ gcc.o version.o $(LIBS)

# Note: If you have SunOS 4.0, you can't use GNU LD to link programs
# which use shared libraries.  You could add -DNO_GNU_LD to this
# command line, but be warned that collect is not really powerful
# enough to do right by all C++ static constructors, and it would
# be better if you could just add support to GNU LD to handle
# shared libraries.
gcc.o: gcc.c $(CONFIG_H)
	$(CC) $(CFLAGS) -c -Iconfig -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-\" \
	-DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" $<

newld.o: newld.c
	-if cmp -s tm.h config/tm-sun3+.h; then \
		OPTS='-Dmc68020 -DSUN3=3 -DTARGET=SUN3'; \
		DFLTS='"$(libdir)", "/lib", "/usr/lib", "/usr/local/lib"'; \
	elif cmp -s tm.h config/tm-sun3-fpa+.h; then \
		OPTS='-Dmc68020 -DSUN3=3 -DTARGET=SUN3'; \
		DFLTS='"$(libdir)", "/lib", "/usr/lib", "/usr/local/lib"'; \
	elif cmp -s tm.h config/tm-sun3-nfp+.h; then \
		OPTS='-Dmc68020 -DSUN3=3 -DTARGET=SUN3'; \
		DFLTS='"$(libdir)", "/lib", "/usr/lib", "/usr/local/lib"'; \
	elif cmp -s tm.h config/tm-sun2+.h; then \
		OPTS='-Dmc68010 -DSUN2=2 -DTARGET=SUN2'; \
		DFLTS='"$(libdir)", "/lib", "/usr/lib", "/usr/local/lib"'; \
	elif cmp -s tm.h config/tm-sun4os3+.h; then \
		OPTS='-DSUN4=4 -DTARGET=SUN4'; \
		DFLTS='"$(libdir)", "/lib", "/usr/lib", "/usr/local/lib"'; \
	elif cmp -s tm.h config/tm-sun4os4+.h; then \
		OPTS='-DSUN4=4 -DTARGET=SUN4'; \
		DFLTS='"$(libdir)", "/lib", "/usr/lib", "/usr/local/lib"'; \
	elif cmp -s tm.h config/tm-sparc+.h; then \
		OPTS='-DSUN4=4 -DTARGET=SUN4'; \
		DFLTS='"$(libdir)", "/lib", "/usr/lib", "/usr/local/lib"'; \
	elif cmp -s tm.h config/tm-encore.h; then \
		CRT0_OPTIONS='-DUMAX'; \
		DFLTS='"$(libdir)", "/lib", "/usr/lib", "/usr/local/lib"'; \
	elif cmp -s tm.h config/tm-altos3068.h; then \
		OPTS='-DCOFF_ENCAPSULATE -DNON_NATIVE -DUSG -DPORTAR'; \
	elif cmp -s tm.h tm-i386gas+.h; then \
		OPTS='-DUSG -DCOFF_ENCAPSULATE -DNON_NATIVE -DPORTAR'; \
	else \
		OPTS='-DTARGET=-1'; \
		DFLTS='"$(libdir)", "/lib", "/usr/lib", "/usr/local/lib"'; \
	fi; \
	echo $$OPTS $$DFLTS; \
	if [ "$$DFLTS" = "" ] ; \
	then \
	$(CC) -c -v $$OPTS $(PROFILE) $(CFLAGS) $(CFLAGS) newld.c ; \
	else \
	$(CC) -c -v $$OPTS -DSTANDARD_SEARCH_DIRS="$$DFLTS" $(PROFILE) $(CFLAGS) $(CFLAGS) newld.c ; \
	fi

ld.o: ld.c
	-if cmp -s tm.h config/tm-sun3+.h; then \
		OPTS='-Dmc68020 -DSUN3=3 -DTARGET=SUN3'; \
	elif cmp -s tm.h config/tm-sun3-fpa+.h; then \
		OPTS='-Dmc68020 -DSUN3=3 -DTARGET=SUN3'; \
	elif cmp -s tm.h config/tm-sun3-nfp+.h; then \
		OPTS='-Dmc68020 -DSUN3=3 -DTARGET=SUN3'; \
	elif cmp -s tm.h config/tm-sun2+.h; then \
		OPTS='-Dmc68010 -DSUN2=2 -DTARGET=SUN2'; \
	elif cmp -s tm.h config/tm-sun4os3+.h; then \
		OPTS='-DSUN4=4 -DTARGET=SUN4'; \
	elif cmp -s tm.h config/tm-sun4os4+.h; then \
		OPTS='-DSUN4=4 -DTARGET=SUN4'; \
	elif cmp -s tm.h config/tm-sparc+.h; then \
		OPTS='-DSUN4=4 -DTARGET=SUN4'; \
	elif cmp -s tm.h config/tm-encore.h; then \
		CRT0_OPTIONS='-DUMAX'; \
	elif cmp -s tm.h config/tm-altos3068.h; then \
		OPTS='-DCOFF_ENCAPSULATE -DNON_NATIVE -DUSG -DPORTAR'; \
	elif cmp -s tm.h tm-i386gas+.h; then \
		OPTS='-DUSG -DCOFF_ENCAPSULATE -DNON_NATIVE -DPORTAR'; \
	else \
		OPTS='-DTARGET=-1'; \
	fi; \
	echo $$OPTS; \
	$(CC) -c $$OPTS $(PROFILE) $(CFLAGS) -DDEFAULT_SEARCH_PREFIX=\"$(libdir)\" ld.c

# if newld.c does not work as well as ld.c does for you,
# then change `newld' to `ld'.

ld++: newld.o
	$(CC) -o ld++ $(PROFILE) newld.o -lg -lc

collect.o: collect.c config.h
	-if cmp -s tm.h config/tm-encore.h; then \
		COLLECT_OPTIONS='-DUMAX'; \
	else \
		COLLECT_OPTIONS=''; \
	fi; \
	$(CC) $(PROFILE) $$COLLECT_OPTIONS $(CFLAGS) -c $<

collect: collect.o $(LIBDEPS)
	$(CC) -o collect $(PROFILE) collect.o -lg $(LIBS) -lc

crt0+.o: crt0.c config.h
	-if cmp -s tm.h config/tm-vax.h; then \
		CRT0_OPTIONS='-DCRT0_DUMMIES='; \
	elif cmp -s tm.h config/tm-vaxv.h; then \
		CRT0_OPTIONS='-DCRT0_DUMMIES='; \
	elif cmp -s tm.h config/tm-vms.h; then \
		CRT0_OPTIONS='-DCRT0_DUMMIES='; \
	elif cmp -s tm.h config/tm-hp9k320.h; then \
		CRT0_OPTIONS='-Umc68000'; \
	elif cmp -s tm.h config/tm-hp9k320g.h; then \
		CRT0_OPTIONS='-Umc68000'; \
	elif cmp -s tm.h config/tm-sequent.h; then \
		CRT0_OPTIONS='-DCRT0_DUMMIES= -DDOT_GLOBAL_START'; \
	elif cmp -s tm.h config/tm-altos3068.h; then \
		CRT0_OPTIONS='-DCRT0_DUMMIES= -Umc68000 -Um68k'; \
	elif cmp -s tm.h tm-i386gas+.h; then \
		CRT0_OPTIONS='-DCRT0_DUMMIES=bogus_fp, -DDOT_GLOBAL_START'; \
	else \
		CRT0_OPTIONS=''; \
	fi; \
	echo $$CRT0_OPTIONS; \
	$(CC) -Um68k $$CRT0_OPTIONS $(CFLAGS) -c -Iconfig crt0.c
	mv crt0.o crt0+.o

CRT1_COMMAND=$(CC) -Um68k -g -c -Iconfig crt1.c

crt1+.o: crt1.c config.h
	$(CRT1_COMMAND)
	mv crt1.o crt1+.o

cc1plus: $(CPLUS_OBJS) $(OBJS) $(LIBDEPS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o cc1plus $(CPLUS_OBJS) $(OBJS) $(LIBS)

cplus-decl.o : cplus-decl.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h cplus-parse.h
cplus-typeck.o : cplus-typeck.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
cplus-class.o : cplus-class.c $(CONFIG_H) $(CPLUS_TREE_H)
cplus-init.o : cplus-init.c $(CONFIG_H) $(CPLUS_TREE_H)
cplus-method.o : cplus-method.c $(CONFIG_H) $(CPLUS_TREE_H)
cplus-cvt.o : cplus-cvt.c $(CONFIG_H) $(CPLUS_TREE_H)
cplus-search.o : cplus-search.c $(CONFIG_H) $(CPLUS_TREE_H)
cplus-ptree.o : cplus-ptree.c $(CONFIG_H) $(TREE_H)
new-cplus-method.o : new-cplus-method.c $(CONFIG_H) $(CPLUS_TREE_H)

cplus-parse.tab.o : cplus-parse.tab.c $(CONFIG_H) $(CPLUS_TREE_H) cplus-parse.h flags.h
	$(CC) -c $(CFLAGS) -Iconfig -DPARSE_OUTPUT=\"$(PWD)/cplus-parse.output\" $<

cplus-parse.tab.c : cplus-parse.y
	@echo expect 41 shift/reduce conflicts and 4 reduce/reduce conflicts
	$(BISON) $(BISONFLAGS) cplus-parse.y

cplus-lex.o : cplus-lex.c $(CONFIG_H) $(CPLUS_TREE_H) cplus-parse.h cplus-parse.tab.h
rtl.o : rtl.c $(CONFIG_H) $(RTL_H)

# Language-independent files.

tree.o : tree.c $(CONFIG_H) $(TREE_H) flags.h $(CPLUS_TREE_H)
print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) $(CPLUS_TREE_H)
fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H)
toplev.o : toplev.c $(CONFIG_H) $(TREE_H) flags.h
	$(CC) -c $(CFLAGS) -Iconfig -DSORRY_EXIT_CODE=35 $<

rtl.o : rtl.c $(CONFIG_H) $(RTL_H)

varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h expr.h \
   insn-codes.h hard-reg-set.h $(CPLUS_TREE_H)
stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
   insn-flags.h expr.h insn-config.h regs.h insn-codes.h
expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
   insn-flags.h insn-codes.h expr.h insn-config.h recog.h $(CPLUS_TREE_H)
expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
   insn-flags.h insn-codes.h expr.h insn-config.h recog.h
explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h
optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h  \
   insn-flags.h insn-codes.h expr.h insn-config.h recog.h
symout.o : symout.c $(CONFIG_H) $(TREE_H) $(RTL_H) symseg.h gdbfiles.h
dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h $(CPLUS_TREE_H)
sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h

emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) regs.h insn-config.h real.h

integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h \
   insn-flags.h insn-codes.h

jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h regs.h
stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h

cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h
loop.o : loop.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
   regs.h recog.h flags.h expr.h
flow.o : flow.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h
combine.o : combine.c $(CONFIG_H) $(RTL_H) flags.h  \
   insn-config.h regs.h basic-block.h recog.h
regclass.o : regclass.c $(CONFIG_H) $(RTL_H) flags.h regs.h \
   insn-config.h recog.h hard-reg-set.h
local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h \
   insn-config.h recog.h hard-reg-set.h
global-alloc.o : global-alloc.c $(CONFIG_H) $(RTL_H) flags.h  \
   basic-block.h regs.h hard-reg-set.h insn-config.h

reload.o : reload.c $(CONFIG_H) $(RTL_H)  \
   reload.h recog.h hard-reg-set.h insn-config.h regs.h
reload1.o : reload1.c $(CONFIG_H) $(RTL_H) flags.h  \
   reload.h regs.h hard-reg-set.h insn-config.h basic-block.h
caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
   reload.h regs.h hard-reg-set.h insn-config.h basic-block.h recog.h
final.o : final.c $(CONFIG_H) $(RTL_H) regs.h recog.h conditions.h gdbfiles.h \
   insn-config.h real.h
recog.o : recog.c $(CONFIG_H) $(RTL_H)  \
   regs.h recog.h hard-reg-set.h insn-config.h

# Normally this target is not used; but it is used if you
# define ALLOCA=alloca.o.  In that case, you must get a suitable alloca.c
# from the GNU Emacs distribution.
# Note some machines won't allow $(CC) without -S on this source file.
alloca.o:	alloca.c
	$(CC) $(CFLAGS) -S alloca.c
	as alloca.s -o alloca.o

# Now the source files that are generated from the machine description.

.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
  insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c

# The following pair of rules has this effect:
# genconfig is run only if the md has changed since genconfig was last run;
# but the file insn-config.h is touched only when its contents actually change.

# Each of the other insn-* files is handled by a similar pair of rules.

insn-config.h: stamp-config.h ;
stamp-config.h : md genconfig
	./genconfig md > tmp-insn-config.h
	./move-if-change tmp-insn-config.h insn-config.h
	touch stamp-config.h

insn-flags.h: stamp-flags.h ;
stamp-flags.h : md genflags
	./genflags md > tmp-insn-flags.h
	./move-if-change tmp-insn-flags.h insn-flags.h
	touch stamp-flags.h

insn-codes.h: stamp-codes.h ;
stamp-codes.h : md gencodes
	./gencodes md > tmp-insn-codes.h
	./move-if-change tmp-insn-codes.h insn-codes.h
	touch stamp-codes.h

insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h insn-config.h real.h
	$(CC) $(CFLAGS) -Iconfig -c $<

insn-emit.c: stamp-emit.c ;
stamp-emit.c : md genemit
	./genemit md > tmp-insn-emit.c
	./move-if-change tmp-insn-emit.c insn-emit.c
	touch stamp-emit.c

insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h
	$(CC) $(CFLAGS) -Iconfig -c $<

insn-recog.c: stamp-recog.c ;
stamp-recog.c : md genrecog
	./genrecog md > tmp-insn-recog.c
	./move-if-change tmp-insn-recog.c insn-recog.c
	touch stamp-recog.c

insn-extract.o : insn-extract.c $(RTL_H)
	$(CC) $(CFLAGS) -Iconfig -c $<

insn-extract.c: stamp-extract.c ;
stamp-extract.c : md genextract
	./genextract md > tmp-insn-extract.c
	./move-if-change tmp-insn-extract.c insn-extract.c
	touch stamp-extract.c

insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h real.h
	$(CC) $(CFLAGS) -Iconfig -c $<

insn-peep.c: stamp-peep.c ;
stamp-peep.c : md genpeep
	./genpeep md > tmp-insn-peep.c
	./move-if-change tmp-insn-peep.c insn-peep.c
	touch stamp-peep.c

insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
    insn-config.h insn-flags.h output.h aux-output.c
	$(CC) $(CFLAGS) -Iconfig -c $<

insn-output.c: stamp-output.c ;
stamp-output.c : md genoutput
	./genoutput md > tmp-insn-output.c
	./move-if-change tmp-insn-output.c insn-output.c
	touch stamp-output.c

# Now the programs that generate those files.

genconfig : genconfig.o rtl.o $(LIBDEPS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o genconfig genconfig.o rtl.o $(LIBS)

genconfig.o : genconfig.c $(RTL_H)
	$(CC) $(CFLAGS) -Iconfig -c $<

genflags : genflags.o rtl.o $(LIBDEPS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o genflags genflags.o rtl.o $(LIBS)

genflags.o : genflags.c $(RTL_H)
	$(CC) $(CFLAGS) -Iconfig -c $<

gencodes : gencodes.o rtl.o $(LIBDEPS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o gencodes gencodes.o rtl.o $(LIBS)

gencodes.o : gencodes.c $(RTL_H)
	$(CC) $(CFLAGS) -Iconfig -c $<

genemit : genemit.o rtl.o $(LIBDEPS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o genemit genemit.o rtl.o $(LIBS)

genemit.o : genemit.c $(RTL_H)
	$(CC) $(CFLAGS) -Iconfig -c $<

genrecog : genrecog.o rtl.o $(LIBDEPS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o genrecog genrecog.o rtl.o $(LIBS)

genrecog.o : genrecog.c $(RTL_H)
	$(CC) $(CFLAGS) -Iconfig -c $<

genextract : genextract.o rtl.o $(LIBDEPS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o genextract genextract.o rtl.o $(LIBS)

genextract.o : genextract.c $(RTL_H)
	$(CC) $(CFLAGS) -Iconfig -c $<

genpeep : genpeep.o rtl.o $(LIBDEPS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o genpeep genpeep.o rtl.o $(LIBS)

genpeep.o : genpeep.c $(RTL_H)
	$(CC) $(CFLAGS) -Iconfig -c $<

genoutput : genoutput.o rtl.o $(LIBDEPS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o genoutput genoutput.o rtl.o $(LIBS)

genoutput.o : genoutput.c $(RTL_H)
	$(CC) $(CFLAGS) -Iconfig -c $<

# Making the preprocessor
cpp: cccp
	-rm -f cpp
	ln cccp cpp
cccp: cccp.o cexp.o version.o $(LIBDEPS)
	$(CC) $(CFLAGS) $(LDFLAGS) -o cccp cccp.o cexp.o version.o $(LIBS)
cexp.o: cexp.c
cexp.c: cexp.y
	$(BISON) cexp.y
	mv cexp.tab.c cexp.c
cccp.o: cccp.c
	$(CC) $(CFLAGS) -Iconfig -DGCC_INCLUDE_DIR=\"$(libdir)/gcc-include\" \
          -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" -c cccp.c

cpp.info: cpp.texinfo
	makeinfo $<

g++.info: g++.texinfo
	makeinfo $<

# gnulib is not deleted because deleting it would be inconvenient
# for most uses of this target.
clean:
	-rm -f $(STAGESTUFF) $(STAGE_GCC)
	-rm -f stamp-*.[ch]
	-rm -f *.s *.s[0-9] *.co *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
	-rm -f core

# Get rid of every file that's generated from some other file (except INSTALL).
realclean: clean
	-rm -f cpp.aux cpp.cps cpp.fns cpp.info cpp.kys cpp.pgs cpp.tps cpp.vrs
	-rm -f cplus-parse.tab.c cplus-parse.output cplus-parse.tab.h
	-rm -f errs gnulib cexp.c TAGS tm-*+.h
	-rm -f g++.info* g++.?? g++.??s g++.log g++.toc g++.*aux
	-rm -f cccp cpp

# Like realclean but also delete the links made to configure gcc.
cleanlinks: realclean
	-rm -f tm.h aux-output.c config.h md config.status

# Copy the files into directories where they will be run.
install: all
	-mkdir $(libdir)
	-mkdir $(bindir)
	-mkdir $(startdir)
	-if [ -f cc1plus  ] ; then $(INSTALL) cc1plus  $(libdir)/gcc-cc1plus ;fi
	$(INSTALL) g++ $(bindir)
	-if [ -f ld++ ] ; then $(INSTALL) ld++ $(libdir)/gcc-ld++ ;fi
	-if [ -f crt0+.o ] ; then $(INSTALL) crt0+.o $(startdir)/crt0+.o ;fi
	-if [ -f crt1+.o ] ; then $(INSTALL) crt1+.o $(startdir)/crt1+.o ;fi
	-mkdir $(libdir)/g++-include
	chmod ugo+rx $(libdir)/g++-include

# do make -f Makefile maketest DIR=../gcc TDIR=../gcc-test
# in the intended test directory to make it a suitable test directory.
maketest:
	-rm -f =*
	-ln -s $(DIR)/.gdbinit .
	-ln -s $(DIR)/bison.simple .
	-ln -s $(DIR)/config.gcc .
	-ln -s $(DIR)/move-if-change .
	$(MAKE) clean
	make-links.g++
	-ln -s $(DIR)/gen*.c .
	-ln -s $(TDIR)/obstack.o $(TDIR)/rtl.o $(TDIR)/emit-rtl.o \
	  $(TDIR)/insn-*.? $(TDIR)/jump.o $(TDIR)/cse.o \
	  $(TDIR)/loop.o $(TDIR)/flow.o $(TDIR)/stupid.o $(TDIR)/combine.o \
	  $(TDIR)/regclass.o $(TDIR)/local-alloc.o $(TDIR)/global-alloc.o \
	  $(TDIR)/reload.o $(TDIR)/reload1.o $(TDIR)/caller-save.o \
	  $(TDIR)/final.o $(TDIR)/recog.o $(TDIR)/gen*.o $(TDIR)/genemit \
	  $(TDIR)/genoutput $(TDIR)/genrecog $(TDIR)/genextract \
	  $(TDIR)/genflags $(TDIR)/gencodes $(TDIR)/genconfig \
	  $(TDIR)/genpeep .
	-rm tm.h aux-output.c config.h md
# You must then run config.g++ to set up for compilation.

bootstrap: all force
	echo GNU C++ does not bootstrap itself

.PHONY: stage1 stage2 stage3 #In GNU Make, ignore whether `stage*' exists.
force:

TAGS: force
	mkdir temp
	-mv cplus-parse.tab.c cexp.c c-*.c temp
	etags *.y *.h *.c
	mv temp/* .
	rmdir temp

#In GNU Make, ignore whether `stage*' exists.
.PHONY: stage1 stage2 stage3 clean realclean TAGS bootstrap

force:
